package com.xingxue.logistics.common.vo;

import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.LinkedList;
import java.util.List;

public class RoleTreeNode {
    private Integer id;
    private Boolean checked;
    private  String text;

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public RoleTreeNode() {
    }

    public RoleTreeNode(Integer id, Boolean checked, String text) {
        this.id = id;
        this.checked = checked;
        this.text = text;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, new MultilineRecursiveToStringStyle())
                .append("id", id)
                .append("checked", checked)
                .append("text", text)
                .toString();
    }

    public static List<RoleTreeNode> buildTree(List<RoleTreeNode> src) {
        List<RoleTreeNode> rootNodeList = new LinkedList<>();
        for (RoleTreeNode node : src) {
            rootNodeList.add(node);
        }
        return rootNodeList;
    }

}
